import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity('user')
export class User {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ length: 50, unique: true })
  username: string;

  //  @Column({ length: 50, unique: true })
  //  user_id: string;



  @Column({ name: 'password_hash', length: 100 })
  password: string;

  @Column({ name: 'refresh_token', type: 'text', nullable: true })
  refreshToken: string | null;

  @CreateDateColumn()
  createdAt: Date;
}

@Entity('user_whitelist')
export class UserWhitelist {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ length: 50, unique: true })
  username: string;

  @Column({ default: true })
  isEnabled: boolean;

  @CreateDateColumn()
  createdAt: Date;
}

@Entity('user_device')
export class UserDevice {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ length: 100 })
  deviceName: string;

  @Column({ length: 100 })
  deviceId: string;

  @Column({ length: 50 })
  deviceType: string;

  @Column('json')
  deviceInfo: Record<string, any>;

  @CreateDateColumn()
  createdAt: Date;

  @UpdateDateColumn()
  updatedAt: Date;
} 